<%-- 
    Document   : sales_report
    Created on : Apr 26, 2010, 12:19:15 AM
    Author     : numessi
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="biz.source_code.miniTemplator.MiniTemplator"%>

<%
            if (session.getAttribute("User") != null) {

                String templateFileName = "sales_report.html";
                String aPath = pageContext.getServletContext().getRealPath(request.getRequestURI()).replace('\\', '/');
                String cPath = request.getContextPath();
                if (cPath.length() > 1) {
                    int f1 = aPath.lastIndexOf(cPath);
                    aPath = aPath.substring(0, f1) + aPath.substring(f1 + cPath.length());
                }
                aPath = aPath.substring(0, aPath.lastIndexOf('/') + 1);
                MiniTemplator templator = new MiniTemplator(aPath + templateFileName);
                if (session.getAttribute("UserRole").equals("NationalManager")) {
                    templator.addBlock("Location", false);
                    templator.addBlock("Range", false);
                    out.print(templator.generateOutput());
                } else {
                    templator.addBlock("Range", false);
                    out.print(templator.generateOutput());
                }

            } else {
                response.sendRedirect("login.jsp");
            }

%>
